/** @file DC.h
 * @brief Drawing Device Contect
 * @author    - Robert Zhang <armner@gmail.com>
 *            - Wismy Yao <aheynie@gmail.com>
 * @date 2013-05
 * @note
*/
#ifndef _DC_H_
#define _DC_H_

#include "gdi.h"
#include "rect_list.h"

/** @brief Drawing Device Contect
 * @note
 */
class DC
{
public: 
    DC(HWND hWnd =0);
    ~DC();

    //drawing rects list
    RectList *header;//< drawing region
    RectList *idleHeader;//< bypassed region
    Rect *rect;
    HWND hWnd;
    //Gdi *pGdi;

    void operator delete(void *t);
    void *operator new(unsigned int);

    //void releaseClients();
    int cutRect(Rect *rect, HWND hWnd);/**< @brief rectangular cut */
    int pasteRect(Rect *rect);/**< @brief rectangular paste */
    void cleanIdleRect();/**< @brief clean rectangular list*/

    int isZeroSize(const Rect *pRect);/**< @brief check if size zero */
    int isOverlap(const Rect *pRect);/**< @brief check rectangular overlap */
    int isInRect(short x, short y);/**< @brief check if point in rectangular */
    int isOverCover(const Rect *rect);/**< @brief check if  on the top floor*/
    int isInRect(short x, short y, Rect *r);/**< @brief check if in rectangular */

    int intersectRect(Rect *intersectedRect, const Rect *pNewRect);/**< @brief The intersection of the rectangle */
	/*
    ClipRect * listInsertBehind(ClipRect *list, ClipRect *item);
    ClipRect * listInsertTail(ClipRect *list, ClipRect *item);
    ClipRect * listInsertBefore(ClipRect *list, ClipRect *item);
    ClipRect * listRemove(ClipRect *list, ClipRect *item);
    ClipRect * listInsert(ClipRect *list, ClipRect *item);

    int removeRect(ClipRect *clips);	//add a new rect to a rect, and devided into 1/4/5 small rects
    int uniteRect(const ClipRect clips);//remove a rect, and form one large rect
    //drawing zone functions
    int setRect(Rect *rect);
*/

    //drawing functions
    int drawPoint(short x0, short y0, char value);/**< @brief draw point */
    int reversePoint(short x0, short y0);/**< @brief reverse Point */
    int fillRect(short x0, short y0, short x1, short y1, char value);/**< @brief Fill the rectangle */
    int drawRect(short x0, short y0, short x1, short y1, char value);/**< @brief Rectangular stroke */
    int reverseRect(short x0, short y0, short x1, short y1);/**< @brief reverse Rectangular */
    int drawFont(short x0, short y0, char *pchar, char valueB,char valueW, FONT* font);/**< @brief Draw the word */
    int drawLine(short x0, short y0, short x1, short y1, char value);/**< @brief draw line */
    int drawCircle(short x0, short y0, short x1, short y1, float cosa, char value);/**< @brief draw circle*/
    int drawString(short x0, short y0, short x1, short y1, char *pchar, char valueB,char valueW, FONT* font);/**< @brief draw string */
    int drawBmp(short x0, short y0, short w, short h, char *pchar);/**< @brief draw bmp */
    int dirty(short x0, short y0, short x1, short y1);/**< @brief */
};



#endif

